package com.yuanfeng.service.impl;

import com.yuanfeng.basedata.entiry.KcsjColumn;
import com.yuanfeng.basedata.entiry.KcsjFood;
import com.yuanfeng.basedata.entiry.KcsjUser;
import com.yuanfeng.basedata.repository.FineFoodRepository;
import com.yuanfeng.basedata.repository.KcsjColumnRepository;
import com.yuanfeng.basedata.repository.UserRepository;
import com.yuanfeng.service.FineFoodService;
import com.yuanfeng.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.Optional;

/**
 * @ClassName UserServiceImpl
 * @Description T0D0
 * @Author yuanfeng
 * @Date 2019/9/6 21:50
 * @Version 1.0
 **/
@Service
@Transactional
public class FineFoodServiceImpl implements FineFoodService {

    @Autowired
    private FineFoodRepository fineFoodRepository;

    @Autowired
    private KcsjColumnRepository columnRepository;


    @Override
    public List<KcsjFood> listFineFoods() {
        return fineFoodRepository.findAll();
    }

    @Override
    public Optional<KcsjFood> findOneFood(Integer foodId) {
        return fineFoodRepository.findById(foodId);
    }

    @Override
    public List<KcsjColumn> getColumnNameDescript(Integer tableId) {

        return columnRepository.findByKcsjTableId(tableId);
    }
}